<header id="topbar" class="affix">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">加奖励详情</a>
            </li>
            <li class="crumb-trail">编辑</li>
        </ol>
    </div>
    <div class="pull-right">
        <a href="javascript:;" class="btn btn-primary btn-sm light fw600 ml10" id='save'><span class="fa fa-save"></span>保存</a>
    </div>
</header>
<br> <br>
<section id="content">
    <div class="dd">
        <p>各彩种期号第一期和最后一期举例：</p>
        <p>重庆时时彩: 20170515001  20170515120</p>
        <p>天津时时彩: 20170515001  20170515084</p>
        <p>新疆时时彩: 2017051501  2017051596</p>
        <p>江苏快三: 2017051501  2017051582</p>
        <p>广西快三: 20170515001  20170515078</p>
        <p>上海11选5: 2017051501  2017051590</p>
        <p>广东11选5: 2017051501  2017051584</p>
        <p>山东11选5: 2017051501  2017051587</p>
        <p>江西11选5: 2017051501  2017051584</p>
    </div>
    <br><br>
    <div class="panel">
        <form class="form-horizontal">
            <div class="form-group">
                <label for="inputTitle" class="col-md-1 control-label">名称：</label>
                <div class="col-md-4">
                    <input type="text" id="inputTitle" class="form-control" data-field="title" value="<%= info.title %>" required>
                </div>
                <label for="inputRemark" class="col-md-1 control-label">备注：</label>
                <div class="col-md-4">
                    <input type="text" id="inputRemark" class="form-control" data-field="remark" value="<%= info.remark %>">
                </div>
            </div>
            <% var moment = require('moment'); %>
                <div class="form-group">
                <label for="inputStartTerm" class="col-md-1 control-label">开始期号：</label>
                <div class="col-md-4">
                    <input type="text" id="inputStartTerm" class="form-control" data-field="start_term" required
                    value=<%= info.condition ? JSON.parse(info.condition).term[0][0] : "" %>>
                </div>
                <label for="inputEndTerm" class="col-md-1 control-label">结束期号：</label>
                <div class="col-md-4">
                    <input type="text" id="inputEndTerm" class="form-control" data-field="end_term" required
                    value=<%= info.condition ? JSON.parse(info.condition).term[0][1] :  "" %>>
                </div>
            </div>
            <div class="form-group">
                <label for="inputActivityType" class="col-md-1 control-label">彩种：</label>
                <div class="col-md-4">
                    <select onchange="changeSelect();" data-field="activity_type" id="inputActivityType" class="form-control multiselect">
                        <% _.each(window.LOTTERY_TYPE, function(value, index){ %>
                            <option <%= index == info.activity_type ? "selected" : ""  %>  value="<%= index %>"> <%= value %> </option>
                        <% }) %>
                    </select>
                </div>
                <label for="inputBetType" class="col-md-1 control-label">玩法：</label>
                <div class="col-md-4">
                    <select data-field="bet_type" class="form-control multiselect" id="inputBetType">
                        <option value="0">全部</option>
                      <% _.each(window.BET_TYPE[info.activity_type], function(value, index){  %>
                        <option value="<%= index %>"  <%= index == info.bet_type ? "selected" : "" %> >  <%= value %>  </option>
                      <% }) %>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="inputAmount" class="col-md-1 control-label">加奖金额：</label>
                <div class="col-md-4">
                    <input type="text" id="inputAmount" class="form-control" value="<%= info.amount %>" data-field="amount">
                </div>
                <label for="inputRate" class="col-md-1 control-label">加奖比例(%)：</label>
                <div class="col-md-4">
                    <input type="text" id="inputRate" class="form-control" value="<%= info.rate %>" data-field="rate">
                </div>
            </div>
        </form>
    </div>
</section>
<script>
    function changeSelect(){
        $('#inputBetType').html();
        var activity_type = $('#inputActivityType').val();
        var bet_types = window.BET_TYPE[activity_type];
        $('#inputBetType').html('<option value="0">全部</option>');
       $.each(bet_types, function(key, value){
            if(key != 'name')
            document.getElementById('inputBetType').innerHTML += ("<option value='"+key+"'>"+value+"</option>");
       })
    }
</script>